import ajax from '@/utils/sysAjax'
import loginAjax from "@/utils/loginAjax";
import type * as loginModel from '@/api/model/loginModel'
import type { CustomResponse } from 'uni-ajax'

class LoginService {
  /**
   * 账号登录接口
   */
  mLogin(
    params: loginModel.IMloginParams
  ): Promise<any> {
    return loginAjax.post('/oauth2/token', params)
  }

  /**
   * 小程序登录接口
   */
  login(
    params: loginModel.ILoginParams
  ): Promise<CustomResponse<loginModel.ILoginResponse>> {
    return ajax.post('/sys/wechat/login', params)
  }

  /**
   * 退出登录
   */
  logout(token: string): Promise<CustomResponse<null>> {
    return ajax.post('/sys/logout', { token })
  }
  /**
   * 短信接口
   */
  sms(params: loginModel.ISmsParams): Promise<CustomResponse<any>> {
    return ajax.post('/sys/sms', params)
  }
  /**
   * 短信登录
   */
  smsLogin(
    params: loginModel.ISmsLoginParams
  ): Promise<any> {
    return loginAjax.post('/oauth2/token', params)
  }


}

export default new LoginService()
